<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form id="resetPasswordForm" method="post">
    原密码：<input type="password" name="password" id="password"><span id="#passwordInfo"></span><br/>
    新密码：<input type="password" name="newPassword" id="resetPassword"><br/>
    <input type="submit" value="修改"/>
    <input type="button" value="返回" onclick="goIndex()"/>
</form>
<script src="js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
<script >
    $(function () {
        $("#resetPasswordForm").submit(function (event) {
            event.preventDefault();
            let formData = new FormData(this);
            $.ajax(
                {
                    type:"post",
                    url:"user?action=doResetPassword",
                    data:$("#resetPasswordForm").serialize(),
                    async:true,
                    success:function (data){
                        if (data == "1"){
                            alert("修改成功！！！！")
                            //跳转到安全退出
                            window.location = "user?action=doLoginOut";
                        }else if (data == "-1"){
                            alert("修改失败原密码错误");
                        }
                    }
                }
            )

        })
    })
    function  goIndex(){
        window.location = "index.html";
    }
</script>
</body>
</html>